<%@ page import="java.util.List" %>
<%@ page import="com.st.service.IDeptService" %>
<%@ page import="com.st.service.impl.DeptServiceImpl" %>
<%@ page import="com.st.enity.Dept" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>部门列表</title>
    <link rel="stylesheet" type="text/css" href="css/site.css">
</head>
<body>
<jsp:include page="header.jsp"></jsp:include>
<jsp:include page="menu.jsp"></jsp:include>
<div class="container">
    <h1>部门列表</h1>
    </form>
    <table border="1" width="100%">
        <tr>
            <th>部门编号</th>
            <th>部门名称</th>
            <th>楼层</th>
            <th>办公电话</th>
            <th>操作</th>
        </tr>
        <!-- 解析数据 -->

        <%
            IDeptService deptService = new DeptServiceImpl();
            List<Dept> depts = deptService.getAll();
            String strId = request.getParameter("did");
            int ida = Integer.parseInt(strId);
            System.out.print(ida);
                //User user = users.get(i);
                Dept dept = depts.get(ida-1);
        %>
        <form action="dept.do?action=change" method="post">
            <tr>
                <td><input type="text" name="did" value="<%=dept.getDid() %>"/></td>
                <td><input type="text" name="dname" value="<%=dept.getDname() %>"/></td>
                <td><input type="text" name="droom" value="<%=dept.getDroom() %>"/></td>
                <td><input type="text" name="dphone" value="<%=dept.getDphone() %>"/></td>
                <td>
                    <input type="submit" value="保存"><br>
                </td>
            </tr>
            </form>
    </table>
</div>
</body>
</html>
